﻿using System;
using UnityEngine;

// Token: 0x0200029E RID: 670
public class PlayerRaygunProjectile : RaygunProjectile
{
	// Token: 0x06000F05 RID: 3845 RVA: 0x00072FC4 File Offset: 0x000711C4
	protected override void Start()
	{
		base.Start();
		this.audioSource.clip = SoundManager.This.GetPlayerRaygunProjectileImpactSound();
		this.lifeTime = (float)GlobalPreferences.PlayerProjectileLifetime.value;
		this.createImpactParticles = GlobalPreferences.PlayerProjectileImpactParticles.value;
		this.particlesScaleMult = GlobalPreferences.PlayerProjectileImpactParticlesSizeMult.value;
	}

	// Token: 0x06000F06 RID: 3846 RVA: 0x00073020 File Offset: 0x00071220
	public void Initialize(float polarityMagnitude, float chargeMultiplier, Color color, LayerMask mask, float playerScale)
	{
		this.mask = mask;
		this.magnitude = polarityMagnitude;
		this.chargeVal = chargeMultiplier;
		this.baseSpeed = 20f * GlobalPreferences.PlayerProjectileSpeed.value * playerScale;
		this.mainColor = color;
		float duration = (GlobalPreferences.ProjectileEffectMode.value != 0) ? 0.01f : GlobalPreferences.ProjectileSpurtDuration.value;
		float factor = 0.02f * polarityMagnitude * chargeMultiplier * GlobalPreferences.ProjectileEffectMultiplier.value;
		this.resizer = new ResizeManager.Resizer(duration, factor, false);
		this.SetColor(color, polarityMagnitude);
		base.transform.localScale *= chargeMultiplier * playerScale;
	}

	// Token: 0x06000F07 RID: 3847 RVA: 0x000730CC File Offset: 0x000712CC
	protected override void Impact(GameObject hitObject)
	{
		if (hitObject.layer != Layers.mapLayer)
		{
			if (!GlobalPreferences.RaygunScriptMode.value)
			{
				ResizeManager resizeManager = hitObject.GetComponent<ResizeManager>() ?? hitObject.AddComponent<ResizeManager>();
				resizeManager.AddResizer(this.resizer);
			}
			else
			{
				EventManager.SendEvent(new PlayerRaygunHitEvent(hitObject.GetComponent<EntityBase>(), this.magnitude, 0, this.chargeVal / 24f));
			}
		}
		base.Impact(hitObject);
	}

	// Token: 0x040013FD RID: 5117
	private float chargeVal;

	// Token: 0x040013FE RID: 5118
	private float magnitude;

	// Token: 0x040013FF RID: 5119
	private ResizeManager.Resizer resizer;
}
